import axios from './http'

export function findSalesOrders(page, size, form, status) {
    return axios.get('/findSalesOrders', {
        params: {
            page: page,
            size: size,
            beginDate: form.beginDate,
            endDate: form.endDate,
            salesType: form.salesType,
            orderType: form.orderType,
            customerType: form.customerType,
            status: status,
        }
    })
}

export function deleteSalesOrders(id) {
    return axios.post('/deleteSalesOrders', { id })
}

export function addSalesOrders(form1, form2) {
    return axios.post('/addSalesOrders', {
        id: form1.id,
        orderType: form1.orderType,
        customerName: form1.customerName,
        customerType: form1.customerType,
        employee: form1.employee,
        warehouse: form1.warehouse,
        deliveryDate: form1.deliveryDate,
        salesType: form1.salesType,
        vehicle: form1.vehicle,
        paymentType: form1.paymentType,
        discountAmount: form1.discountAmount,
        total: form1.total,
        goodsList: form2
    })
}

export function getSalesOrdersDetail(id) {
    return axios.get('/getSalesOrdersDetail', {
        params: {
            id: id
        }
    })
}

export function changeSalesOrdersStatus(id, status) {
    return axios.post('/changeSalesOrdersStatus', {
        id: id,
        status: status
    })
}